<?php $general = $this->get('general'); ?>
<div class="x-list-title">
	<table width="100%" border="0" height="100%">
	<tr>
		<td align="left">
			<h2><?php _e($general['name']);?>
			</h2>
		</td>
		<td align="right">	
				<div class="x-list-options">
					<a onclick="load_inframe('<?php _baseUrl();?>/Personnel/Index/Sms?ID[]=<?php _e($post['ID'])?>',{auto_hidden:true,title: 'Giao dịch SMS'})" class="x-button">Gửi SMS</a>
					<div class="x-options-container">
						<a class="x-button"> In thông tin <span>&#9660;</span></a>
						<div class="x-options">
							<a class="x-options-item" href="Personnel/Index/Printcv?ID=<?php _e(get('ID'));?>">Tóm tắt tiểu sử</a>
							<a class="x-options-item" href="Personnel/Index/Printgov?ID=<?php _e(get('ID'));?>">Quản lý đảng</a>
						</div>
					</div>
					<div class="x-options-container">
						<a class="x-button"> Tác vụ khác <span>&#9660;</span></a>
						<div class="x-options">
							<a href="#Personnel/Index/Edit?ID=<?php _e(get('ID'));?>" class="x-options-item">Chỉnh sửa nhân sự</a>
							<a onclick="module_delete('<?php _baseUrl();?>/Personnel/Index/Delete?ID=<?php _e(get('ID'));?>')" class="x-options-item">Xóa nhân sự</a>
							<a href="#Personnel/Index/Add" class="x-options-item">Thêm nhân sự mới</a>
						</div>
					</div>
				</div>
		</td>
	</tr>
	</table>	
</div>
<div class="tab-container" style="overflow: true;margin-top:-2px">
	<div class="tab-bar" style="border-right:1px solid #ccc">
		<a class="tab-link tab-link-first tab-link-active" onclick="do_tab(this,1)">Sơ yếu lý lịch</a>
		<a class="tab-link" onclick="do_tab(this,2)">Quá trình lương</a>
		<a class="tab-link" onclick="do_tab(this,3)">Quá trình đào tạo</a>
		<a class="tab-link" onclick="do_tab(this,4)">Quá trình công tác</a>
		<a class="tab-link" onclick="do_tab(this,5)">Quản lý Đảng</a>
		<a class="tab-link" onclick="do_tab(this,7)">Hợp đồng</a>
		<a class="tab-link" onclick="do_tab(this,6)">File hồ sơ</a>
		<span class="clear"></span>
	</div>
	<div class="tabs">	
		<div class="tab tab-active">
			<div class="x-info-container">
				
				<table width="100%" cellpadding="0" class="x-info">
					<tr>
						<td rowspan="22" align="center" valign="top" width="200">
							<img src="<?php _baseUrl()?>/files/<?php if(!$general['photo']):?>photo/noavatar.gif<?php else:?>/personnel/<?php _e($general['photo']);?><?php endif;?>" style="height:160px;width:120px" class="personnel-photo"/>
						</td>
					</tr>
					<tr>
						<td class="x-info-top" colspan="4">
							<span class="tl">Thông tin chung</span>
							<span class="tr">Cập nhật lần cuối lúc <?php _e( show_date(DATETIME_FORMAT,$general['date_updated']) );?> bởi <?php _e(get_user_link( $general['updated_by_id'],$general['updated_by_name'],$general['updated_is_deleted']) );?></a></span>
						</td>
					</tr>
					<tr>
						<td class="x-info-label" >Số hiệu</td>
						<td class="x-info-content" >
							<b style="color:red;"><?php _e($general["code"]);?></b>
						</td>
						<td class="x-info-label" >Vị trí hồ sơ</td>
						<td class="x-info-content">
							<b style="color:green;"><?php _e($general["position"]);?></b>
						</td>
					</tr>
					<tr>
						<td class="x-info-label" >Họ tên</td>
						<td class="x-info-content">
							<b style="font-weight:bold;"><?php _e($general["name"]);?></b>
						</td>
						<td class="x-info-label">Tên gọi khác</td>
						<td class="x-info-content">
							<?php _e($general["othername"]);?>
						</td>
					</tr>
					<tr>
						<td class="x-info-label">Ngày sinh</td>
						<td class="x-info-content">
							<?php _e(show_date(DATE_FORMAT,$general["birthday"]));?>
						</td>
						<td class="x-info-label">Giới tính</td>
						<td class="x-info-content">
							<?php if($general['gender']==1){_e('Nữ');}else{_e('Nam');}?>
						</td>
					</tr>
					<tr>
						<td class="x-info-label">Phòng ban</td>
						<td>
							<a href="#Personnel?dep_id=<?php _e($general['department_id']);?>"><?php _e($general['department_name']);?></a>
						</td>
						<td class="x-info-label">Chức vụ</td>
						<td class="x-info-content">
							<?php _e($general["functions"]);?>
						</td>
					</tr>
					<tr>
						<td class="x-info-label">Email</td>
						<td class="x-info-content">
							<?php _e($general["email"]);?>
						</td>
					
						<td class="x-info-label">Điện thoại</td>
						<td class="x-info-content">
							<?php _e($general["phone"]);?>
						</td>
					</tr>
					<?php $cvs = $this->get('cvs');?>
					<tr>
						<td class="x-info-top" colspan="4">
							<span class="tl">Lý lịch nhân viên</span>
						</td>
					</tr>
					<tr>
						<td class="x-info-label" >Nơi sinh</td>
						<td class="x-info-content" >
							<?php _e($cvs["born_in"]);?>
						</td>
						<td class="x-info-label" >Quê quán</td>
						<td class="x-info-content">
							<?php _e($cvs["native_country"]);?>
						</td>
					</tr>
					<tr>
						<td class="x-info-label" >Dân tộc</td>
						<td class="x-info-content">
							<?php _e($cvs["nation"]);?>
						</td>
						<td class="x-info-label">Tôn giáo</td>
						<td class="x-info-content">
							<?php _e($cvs["religion"]);?>
						</td>
					</tr>
					<tr>
						<td class="x-info-label">Nơi đăng ký hộ khẩu</td>
						<td class="x-info-content">
							<?php _e($cvs["inhabitant"]);?>
						</td>
						<td class="x-info-label">Nơi ở hiện tại</td>
						<td class="x-info-content">
							<?php _e($cvs['residence'])?>
						</td>
					</tr>
					<tr>
						<td class="x-info-label">Ngày tuyển dụng</td>
						<td>
							<?php _e(show_date(DATE_FORMAT,$cvs["date_recruit"]));?>
						</td>
						<td class="x-info-label">Cơ quan tuyển dụng</td>
						<td class="x-info-content">
							<?php _e($cvs["unit_recruit"]);?>
						</td>
					</tr>
					<tr>
						<td class="x-info-label">Công việc chính</td>
						<td class="x-info-content">
							<?php _e($cvs["main_type_job"]);?>
						</td>
					
						<td class="x-info-label">Sở trường công tác</td>
						<td class="x-info-content">
							<?php _e($cvs["main_active"]);?>
						</td>
					</tr>
					<tr>
						<td class="x-info-label">Trình độ phổ thông</td>
						<td class="x-info-content">
							<?php _e($cvs["skill_common"]);?>
						</td>
					
						<td class="x-info-label">Trình độ chuyên môn</td>
						<td class="x-info-content">
							<?php _e($cvs["skill_speciality_title"]);?>
						</td>
					</tr>
					<tr>
						<td class="x-info-label">Lý luận chính trị</td>
						<td class="x-info-content">
							<?php _e($cvs["argue_politics"]);?>
						</td>
					
						<td class="x-info-label">Quản lý nhà nước</td>
						<td class="x-info-content">
							<?php _e($cvs["skill_manage"]);?>
						</td>
					</tr>
					<tr>
						<td class="x-info-label">Trình độ ngoại ngữ</td>
						<td class="x-info-content">
							<?php _e($cvs["skill_lang"]);?> -- <?php _e($cvs["skill_lang_lv"]);?>
						</td>
					
						<td class="x-info-label">Trình độ tin học</td>
						<td class="x-info-content">
							<?php _e($cvs["skill_info"]);?> -- <?php _e($cvs["skill_info_lv"]);?>
						</td>
					</tr>
					<tr>
						<td class="x-info-label">Ngày nhập - xuất ngũ</td>
						<td class="x-info-content">
							<?php _e(show_date(DATE_FORMAT,$cvs["date_join_army"]));?> - <?php _e(show_date(DATE_FORMAT,$cvs["date_out_army"]));?>
						</td>
					
						<td class="x-info-label">Quân hàm cao nhất</td>
						<td class="x-info-content">
							<?php _e($cvs["army_rank"]);?>
						</td>
					</tr>
					<tr>
						<td class="x-info-label">Danh hiệu phong tặng</td>
						<td class="x-info-content">
							<?php _e($cvs["identifier"]);?>
						</td>
					
						<td class="x-info-label">Ngày tham gia tổ chức XH</td>
						<td class="x-info-content">
							<?php _e(show_date(DATE_FORMAT,$cvs["date_join_institute"]));?>
						</td>
					</tr>
					<tr>
						<td class="x-info-label">Khen thưởng</td>
						<td class="x-info-content">
							<?php _e($cvs["reward"]);?>
						</td>
					
						<td class="x-info-label">Kỷ luật</td>
						<td class="x-info-content">
							<?php _e($cvs["discipline"]);?>
						</td>
					</tr>
					<tr>
						<td class="x-info-label">Tình trạng sức khỏe</td>
						<td class="x-info-content">
							<?php _e($cvs["status"]);?>
						</td>
					
						<td class="x-info-label">Cân đo</td>
						<td class="x-info-content">
							<b>H:</b><?php _e($cvs["tall"]);?> - <b>W:</b><?php _e($cvs["weight"]);?> - <b>Nhóm máu:</b><?php _e($cvs["blood_group"]);?>
						</td>
					</tr>
					<tr>
						<td class="x-info-label">Là thương binh hạng </td>
						<td class="x-info-content">
							<?php _e($cvs["injury"]);?>
						</td>
					
						<td class="x-info-label">Con gia đình chính sách</td>
						<td class="x-info-content">
							<?php _e($cvs["injury_policy"]);?>
						</td>
					</tr>
					<tr>
						<td class="x-info-label">Chứng minh thư nhân dân </td>
						<td class="x-info-content">
							<?php _e($cvs["identity_card"]);?><?php if($cvs["date_iden_sub"]!=NULL){_e(" - Cấp ngày :".show_date(DATE_FORMAT,$cvs["date_iden_sub"]));}?>
						</td>
					
						<td class="x-info-label">Sổ bảo hiểm xã hội</td>
						<td class="x-info-content">
							<?php _e($cvs["safety_number"]);?>
						</td>
					</tr>
				</table>
			</div>
		</div>
	
		<div class="tab">
			<?php $salary = $this->get('salary');?>
			<table  cellpadding="4" width="100%" class="x-list" id="salaryTb">
			   <tr>
				  <th width="90">Ngày bắt đầu</th>
				  <th width="90">Ngạch</th>
				  <th width="90">Bậc lương</th>
				  <th width="90">Hệ số chính</th>
				  <th width="90">Hệ số phụ cấp</th>
				  <th >Tính lương</th>
				  <th width="25"></th>
			   </tr>
			   <?php foreach($salary as $ksa => $vsa): ?>
				<tr>
					<td align="center"><?php _e(show_date(DATE_FORMAT,$vsa['dateup']));?></td>
					<td align="center"><?php _e($vsa['title']);?></td>
					<td align="center"><?php _e($vsa['countb']);?></td>
					<td align="center"><?php _e( (((float)$vsa['countb']) - 1)*$vsa['subsalary'] + (float)$vsa['initsalary']  );?></td>
					<td align="center"><?php _e($vsa['plussalary']);?></td>
					<td align="center">
						<?php 
							$p = (((float)$vsa['countb']) - 1)*$vsa['subsalary'] + $vsa['initsalary'] + (float)$vsa['plussalary'];
							$st = $this->get('setting');
							_e( number_format($p*$st['basic_salary']) );
						?>
					</td>
					<td width="25" align="center">
						<a onclick="module_delete('<?php _baseUrl()?>/Personnel/Index/delsalary?ID=<?php _e($vsa['ID']);?>',this.parentNode.parentNode)" class="x-delete"></a>
					</td>
				</tr>
			   <?php endforeach;?>
				</table>
			
		</div>
		
		<div class="tab">
				<?php $train = $this->get('train');?>
				<table width="100%" class="x-list" cellpadding="0" cellspacing="0">
							<tr>
								<th width="25">TT</th>
								<th width="90">Từ </th>
								<th width="90">Đến</th>
								<th width="200">Nơi đào tạo</th>
								<th width="150">Hệ đào tạo</th>
								<th width="110">Xếp loại</th>
								<th>Ghi chú</th>
								<th width="25"></th>
							</tr>
							<?php foreach($train as $ktrain=>$vtrain){?>
								<tr>
									<td align="center"><?php _e($ktrain+1);?></td>
									<td align="center"><?php _e(show_date(DATE_FORMAT,$vtrain['train_date_from']));?></td>
									<td align="center"><?php _e(show_date(DATE_FORMAT,$vtrain['train_date_to']));?></td>
									<td><?php _e($vtrain['train_at']);?></td>
									<td><?php _e($vtrain['train_level_title']);?></td>
									<td><?php _e($vtrain['train_level_type']);?></td>
									<td><?php _e($vtrain['train_desc']);?></td>
									<td align="center" width="25">
										<a onclick="module_delete('<?php _baseUrl();?>/Personnel/Index/deltrain?ID=<?php _e($vLV['ID'])?>',this.parentNode.parentNode)" class="x-delete"></a>
								</tr>
							<?php }?>
				</table>
			
		</div>
		<?php $crwork_active = $this->get('crwork_active');?>
		<div class="tab">
			<table cellpadding="5" width="100%" class="x-list" >
						<tr>
							<th width="25" align="center">TT</th>
							<th width="100">Từ</th>
							<th width="100">Đến</th>
							<th>Tên đơn vị</th>
							<th>Ghi chú</th>
							<th width="25"></th>
						</tr>
						<?php foreach($crwork_active as $kWA=>$vWA){?>
							<tr>
								<td align="center"><?php _e($kWA+1);?></td>
								<td align="center"><?php _e(show_date(DATE_FORMAT,$vWA['work_date_from']));?></td>
								<td align="center"><?php _e(show_date(DATE_FORMAT,$vWA['work_date_to']));?></td>
								<td><?php _e($vWA['work_company'])?></td>
								<td><?php _e($vWA['work_wnotes'])?></td>
								<td align="center" width="25">
									<a onclick="module_delete('<?php _baseUrl();?>/Personnel/Index/delactivity?ID=<?php _e($vLV['ID'])?>',this.parentNode.parentNode)" class="x-delete"></a>
								</td>
							</tr>
						<?php }?>
			</table>
		</div>
		<div class="tab">
			<div class="x-info-container">
			<?php $govs = $this->get('govs');?>
				<table width="100%" cellpadding="0" class="x-info">
					<tr>
						<td class="x-info-top" colspan="4">
							<span class="tl">Quản lý đảng</span>
						</td>
					</tr>
					<tr>
						<td class="x-info-label" >Thành phần gia đình</td>
						<td class="x-info-content" >
							<?php _e($govs["family"]);?>
						</td>
						<td class="x-info-label" >Nghề nghiệp khi vào đảng</td>
						<td class="x-info-content">
							<?php _e($govs["job"]);?>
						</td>
					</tr>
					<tr>
						<td class="x-info-label" >Công việc chính đang làm</td>
						<td class="x-info-content">
							<?php _e($govs["main_work"]);?>
						</td>
						<td class="x-info-label">Tại</td>
						<td class="x-info-content">
							<?php _e($govs["main_work_at"]);?>
						</td>
					</tr>
					<tr>
						<td class="x-info-label">Ngày vào đảng</td>
						<td class="x-info-content">
							<?php _e(show_date(DATE_FORMAT,$govs["date_gov_trial"]));?>
						</td>
						<td class="x-info-label">Tại chi bộ</td>
						<td class="x-info-content">
							<?php _e($govs['date_gov_trial_at'])?>
						</td>
					</tr>
					<tr>
						<td class="x-info-label">Người giới thiệu 1</td>
						<td>
							<?php _e($govs['per_take1'])?>
						</td>
						<td class="x-info-label">Chức vụ , đơn vị</td>
						<td class="x-info-content">
							<?php _e($govs["per_take1_at"]);?>
						</td>
					</tr>
					<tr>
						<td class="x-info-label">Người giới thiệu 2</td>
						<td class="x-info-content">
							<?php _e($govs["per_take2"]);?>
						</td>
					
						<td class="x-info-label">Chức vụ , đơn vị</td>
						<td class="x-info-content">
							<?php _e($govs["per_take2_at"]);?>
						</td>
					</tr>
					
					<tr>
						<td class="x-info-label">Ngày chính thức</td>
						<td class="x-info-content">
							<?php _e(show_date(DATE_FORMAT,$govs["date_gov_reg"]));?>
						</td>
					
						<td class="x-info-label">Tại chi bộ</td>
						<td class="x-info-content">
							<?php _e($govs["date_gov_reg_at"]);?>
						</td>
					</tr>
					<tr>
						<td class="x-info-label">Ngày tuyển dụng cán bộ công chức</td>
						<td class="x-info-content">
							<?php _e(show_date(DATE_FORMAT,$govs["date_join"]));?>
						</td>
					
						<td class="x-info-label">Cơ quan tuyển dụng</td>
						<td class="x-info-content">
							<?php _e($govs["unit"]);?>
						</td>
					</tr>
					<tr>
						<td class="x-info-label">Gia đình liệt sỹ</td>
						<td class="x-info-content">
							<?php if($govs["fa_lietsy"]=='yes')_e('Có');?>
						</td>
					
						<td class="x-info-label">Gia đình có công với CM</td>
						<td class="x-info-content">
							<?php if($govs["fa_cocong"]=='yes')_e('Có');?>
						</td>
					</tr>
				</table>
				<?php $govact = $this->get('govacts');?>
				<table width="100%" style="margin-top:8px;" class="x-list" cellpadding="0" cellspacing="0">
				<tr>
					<th width="25" align="center">
						TT
					</th>
					<th align="center"  width="100">
						Từ
					</th>
					<th align="center"  width="100">
						Đến
					</th>
					<th align="center" width="250">
						Tại chi bộ
					</th>
					<th align="center" >
						Ghi chú
					</th>
					
					<th align="center" width="25">
						
					</th>
				</tr>	

				<?php foreach( $govact as $kgovact => $agovact ):?>
				<tr>
					<td align="center">
						<?php _e($kgovact+1);?>
					</td>
					<td align="center">
						<?php _e(show_date(DATE_FORMAT,$agovact['date_govs_from']))?>
					</td>
					<td align="center">
						<?php _e(show_date(DATE_FORMAT,$agovact['date_govs_to']))?>
					</td>
					<td>
						<?php _e($agovact['act_at'])?>
					</td>
					<td>
						<?php _e($agovact['act_desc'])?>
					</td>
					
					<td width="25" align="center">
						<a onclick="module_delete('<?php _baseUrl()?>/Personnel/Index/delgovact?ID=<?php _e($a['ID']);?>',this.parentNode.parentNode)" class="x-delete"></a>
					</td>
				</tr>
				<?php endforeach;?>
				</table>
			</div>
		</div>
		<div class="tab">
			<div class="x-info-container">
				<table width="100%" cellpadding="4" class="x-info">
					<tr>
						<td class="x-info-content">
							<?php 
								$file = $this->get('files');
								foreach($file as $f){ ?>
									<?php $a=array();?>
									<?php show_thumb( $f, baseUrl()."/Personnel/Index/File?ID={$f['ID']}");?>
								<?php } ?>
						</td>
					</tr>
				</table>
			</div>
		</div>
		<!--CONTRACTS-->
		<div class="tab">
			<table id="tbContract" width="100%" cellpadding="5" class="x-list" >
               <tr>
				  <th width="160">Tên HĐ</th>
				  <th width="160">Mã HĐ</th>
                  <th>Loại HĐ</th>
                  <th>Ngày ký</th>
                  <th>Ngày có hiệu lực</th>
                  <th width="160">Ngày hết hiệu lực</th>
                  <th width="25"></th>
               </tr>
				<?php foreach($this->get('contracts') as $a ){?>
					<tr>
						<td align="center"><?php _e($a['title']);?></td>
						<td align="center"><?php _e($a['code']);?></td>
						<td align="center"><?php _e($a['type']);?></td>
						<td align="center"><?php _e(show_date(DATE_FORMAT,$a['date_reg']));?></td>
						<td align="center"><?php _e(show_date(DATE_FORMAT,$a['date_start']));?></td>
						<td align="center"><?php _e(show_date(DATE_FORMAT,$a['date_finish']));?></td>
						<td align="center" width="25">
							<a onclick="module_delete('<?php _baseUrl();?>/Personnel/Index/delcontract?ID=<?php _e($a['ID'])?>',this.parentNode.parentNode)" class="x-delete"></a>
					</tr>
				<?php }?>
			</table>			
		</div>		
	</div>
